package cn.edu.sjtu.process_status_data.util;

import cn.edu.sjtu.process_status_data.model.Blank;
import cn.edu.sjtu.process_status_data.model.Examine;
import cn.edu.sjtu.process_status_data.model.Identification;
import cn.edu.sjtu.process_status_data.model.Spinning;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;

public class ModelUtil {

    private static double creatFormat(double init) {
        DecimalFormat df = new DecimalFormat("#.0000");
        return Double.valueOf(df.format(init));
    }

    public static List<Object> spinningData(double a) {
        List<Object> data = new ArrayList<>();
        //旋压设备信息
        Spinning inData = Spinning.builder()
                .thickness(creatFormat(3 + 0.995 * a))
                .insideDiameter(creatFormat(600 + 0.998 * a))
                .downLength(3)
                .feedRate(2)
                .forceX(creatFormat(7 + 1.003 * a))
                .forceY(creatFormat(18 + 0.9984 * a))
                .rotatingSpeed(2)
                .vibration(creatFormat(a))
                .build();
        //旋压标识信息
        Identification idData = Identification.builder()
                .machineId("SIEMENS840D")
                .userId("401")
                .processFile("XY190612-12")
                .workshopId("C201").build();
        data.add(inData);
        data.add(idData);
        return data;
    }

    //毛坯信息
    public static List<Object> blankData(){
        List<Object> data = new ArrayList<>();
        //毛坯物料信息
        Blank inData = Blank.builder()
                .materialId("7075-T651")
                .size("1800*1000*80")
                .furnaceId("C101-L02")
                .certificateNum("201912010056")
                .build();
        //毛坯标识信息
        Identification idData = Identification.builder()
                .machineId("BX5316T")
                .userId("203")
                .processFile("ZP0056-2")
                .workshopId("C101").build();
        data.add(inData);
        data.add(idData);
        return data;
    }

    //检验信息
    public static List<Object> examineData(){
        List<Object> data = new ArrayList<>();
        Examine inData = Examine.builder()
                .qualified(true)
                .size("1800*26650*3").build();
        data.add(inData);
        return data;
    }

}
